@echo off

REM SHA1 sums of files required
REM 9988723269367fb44ef83f627186a1c88cf7877e decoder.4
REM 9cebb8bb935315101d248140d1b4503993ebdf8a decoder.5
REM f003a5a9319c4eb8991fa2aae3f10c72d6b8e81a 01
REM 087c6da93318e8dc922d3d22e0a2af7b9759701c 02
REM 7badb4318b208f49d7fa65e915d0aa22a1e37915 03
REM 6b4d47c2899fe9f14f9dab5928499f12078c437d 04
REM 54f871983699113e31bb756d4ca885c26c2d66b4 05
REM 54b02d944caf95283c9b6f0160e75ea8c4ccc97b 06
REM a487ffcd4920d1056b87469735f7e1002f6a2e49 07
REM 8726ebaf048db9608dfe365bf434ed5ca9452db7 08
REM efacc4a6d4b2af9a236c9d520de6d605c79cc5a8 09
REM ba833f48ddfc1bd04ddb41b1d1c840d66ee7da30 10
REM 6ca39f493eb8b370154ad46ef01976d352c929e1 11
REM c46872550e0ca031453c6513f8f0448ecc9b5572 12
REM 9c4334ac3ff15d94001b22fc367af40f9deb7d57 sg.snd

set rom_path_src=..\roms\stargate
set rom_path_dst=..\build
set romgen_path=..\tools

mkdir %rom_path_dst%
REM generate RAMB structures for larger ROMS

REM soundcpu - the sound ROM is half as big as other games so we double it
copy/b %rom_path_src%\sg.snd+%rom_path_src%\sg.snd %rom_path_dst%\stargate.snd
%romgen_path%\romgen %rom_path_dst%\stargate.snd SND_ROM_0F    12 l r e > %rom_path_dst%\SND_ROM_0F.vhd

REM decoders
%romgen_path%\romgen %rom_path_src%\decoder.4    DECODER_4      9 a     > %rom_path_dst%\DEC_4.vhd
%romgen_path%\romgen %rom_path_src%\decoder.5    DECODER_6      9 a     > %rom_path_dst%\DEC_6.vhd

REM maincpu
%romgen_path%\romgen %rom_path_src%\10           CPU_ROM_0D    12 l r e > %rom_path_dst%\CPU_ROM_0D.vhd
%romgen_path%\romgen %rom_path_src%\11           CPU_ROM_0E    12 l r e > %rom_path_dst%\CPU_ROM_0E.vhd
%romgen_path%\romgen %rom_path_src%\12           CPU_ROM_0F    12 l r e > %rom_path_dst%\CPU_ROM_0F.vhd
%romgen_path%\romgen %rom_path_src%\01           CPU_ROM_10    12 l r e > %rom_path_dst%\CPU_ROM_10.vhd
%romgen_path%\romgen %rom_path_src%\02           CPU_ROM_11    12 l r e > %rom_path_dst%\CPU_ROM_11.vhd
%romgen_path%\romgen %rom_path_src%\03           CPU_ROM_12    12 l r e > %rom_path_dst%\CPU_ROM_12.vhd
%romgen_path%\romgen %rom_path_src%\04           CPU_ROM_13    12 l r e > %rom_path_dst%\CPU_ROM_13.vhd
%romgen_path%\romgen %rom_path_src%\05           CPU_ROM_14    12 l r e > %rom_path_dst%\CPU_ROM_14.vhd
%romgen_path%\romgen %rom_path_src%\06           CPU_ROM_15    12 l r e > %rom_path_dst%\CPU_ROM_15.vhd
%romgen_path%\romgen %rom_path_src%\07           CPU_ROM_16    12 l r e > %rom_path_dst%\CPU_ROM_16.vhd
%romgen_path%\romgen %rom_path_src%\08           CPU_ROM_17    12 l r e > %rom_path_dst%\CPU_ROM_17.vhd
%romgen_path%\romgen %rom_path_src%\09           CPU_ROM_18    12 l r e > %rom_path_dst%\CPU_ROM_18.vhd

echo done
pause
